﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FX.CC.Andon.Entity.BasicDataManage;
using FX.CC.Andon.Entity.DataManage;
using FX.CC.Andon.Service.DataManage;
using FX.CC.Andon.Utility.Json;

namespace FX.CC.Andon.Business.DataManage
{
    public class TaskRecMaintainBusiness
    {
        private readonly TaskRecMaintainService _dal=new TaskRecMaintainService();

        public string GetTaskRecMaintainList(PrdTaskQcEntity qcmodel)
        {
            var total = _dal.GetTaskRecMaintainCount(qcmodel);
            var list = _dal.GetTaskRecMaintainList(qcmodel);
            return JsonHelper.Encode(total, list);
        }

        public bool ModifyTaskRec(string data)
        {
            var model = new TaskRecMaintainEntity();
            var rows = (ArrayList)JsonHelper.Decode(data);
            foreach (Hashtable row in rows)
            {
                model.RecID = new Guid(row["RecID"].ToString());
                model.EndTime = Convert.ToDateTime(row["EndTime"].ToString());
                model.UserID = new Guid(row["UserID"].ToString());
            }
            return _dal.ModifyTaskRec(model);
        }
    }
}
